import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;

/***
 * @author hunter.d
 * @qq 657270652
 * @wx haitao-duan
 * @date 2020/8/15
 **/
public class ImageProcess {
    public static void main(String[] args) throws Exception {
        FileInputStream is = new FileInputStream("d:/3.png");
        BufferedImage bi = ImageIO.read(is);

        BufferedWriter bw = new BufferedWriter(new FileWriter("d:/3.txt"));

        for(int i=0;i<32;i++){
            for(int j=0;j<32;j++){
                int rgb = bi.getRGB(j, i);
                bw.write(rgb==-1?"0":"1");
            }
            bw.newLine();
        }


        bw.close();
        is.close();


    }
}
